﻿using System;
using System.Collections.Generic;
using System.Net;
using JetBlack.AuthFeedBus.Adapters;

namespace ExamplePublisher
{
    class Program
    {
        static void Main(string[] args)
        {
            Client client = new Client();

            // Attempt to connect.
            try
            {
                client.Connect(Dns.GetHostName(), 9124);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failed to connect to distributor: {0}", ex.Message);
                Environment.Exit(-1);
            }

            Dictionary<string, object> data = new Dictionary<string, object>
                {
                    { "NAME", "Vodafone Group PLC" },
                    { "BID", 140.60 },
                    { "ASK", 140.65 }
                };

            client.Publish("LSE", "VOD", true, data);

            Console.WriteLine("Press <ENTER> to quit");
            Console.ReadLine();

            client.Close();
        }
    }
}
